# -*- coding: UTF-8 -*-
"""
@author: tgy
@file: function_demo01.py
@time: 2021/01/24
"""
import sys

def test01(*args,**kwargs):
    ...
    print(type(args),type(kwargs))


def test02(*args,key=None,**kwargs):
    ...
    print(args,key,kwargs)


def my_print(*args,**kwargs):
    """
    def print(self, *args, sep=' ', end='\n', file=None):
    """
    # kwargs.pop('sep')
    sep = kwargs.pop('spe', '')
    end = kwargs.pop('end', '\n')
    file = kwargs.pop('file', sys.stdout)
    out_string = sep.join(str(x) for x in args) + end
    file.write(out_string)


def my_sum(lists):
    ...
    if not isinstance(lists,list):
        return lists
    sum = 0
    for n in lists:
        if isinstance(n,list):
            sum += my_sum(n)
        else:
            sum += n
    return sum

if __name__ == '__main__':
    pass
    # test01(1,2,3,name=23,age=21)
    # test02(1,2,3,opt=122)
    # print()
    # my_print('12','opt')

    print(my_sum([1, [2, [3, 4], 5], 6, [7, 8]]))
    print(my_sum.__code__.co_argcount)
    print(my_sum.__code__.co_varnames)
    my_file = lambda x = 10:x*2
